//
//  TTBaseViewController.m
//  TTWeibo
//
//  Created by 陶宏路 on 16/7/20.
//  Copyright © 2016年 陶路路. All rights reserved.
//

#import "TTBaseViewController.h"
#import "TTOAutoViewController.h"
#import "TTWelcomeModel.h"
@interface TTBaseViewController ()<TTDelegate>



@end

@implementation TTBaseViewController


-(UITableView *)tableView{
    
    if (_tableView == nil) {
        
        _tableView = [[UITableView alloc]init];
    }
    return _tableView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.visionView = [[TTVisionView alloc]init];
    self.visionView.delegate = self;
    self.isLogin = [TTWelcomeModel sharedManager].islogin;

    if (!self.isLogin) {
        
        self.view = _visionView;
        
        self.view.backgroundColor = [UIColor colorWithRed:237/255.0 green:237/255.0 blue:237/255.0 alpha:1];
        
        return ;
    }else{
        
        self.view  = self.tableView;
    }
    
    [self setUpButton];
}

- (void)setUpButton{
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"登录" style:UIBarButtonItemStylePlain target:self action:@selector(didClickButton)];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(didClickButton)];
    
//    [self.navigationController.navigationBar setTintColor:[UIColor orangeColor]];
}

-(void)didCenterButton:(UIButton *)sender and:(TTVisionView *)view{
    
    [self didClickButton];
    
}

-(void)didClickButton{
    
    TTOAutoViewController * vc = [[TTOAutoViewController alloc]init];
    
    [self presentViewController:[[UINavigationController alloc]initWithRootViewController:vc] animated:YES completion:nil];
    

}

@end
